{template 'common/header'}
{template 'wechat/nav'}
<style>
	.marbot0{margin-bottom:0}
	.form{display:none}
	.clear{width:100%;height:0;clear:both;}
	.alert{margin:1px 0;padding:10px 15px;background:#F5F5F5;}
	.card-title{background: url("./resource/images/card.png") no-repeat scroll 0 -84px rgba(0, 0, 0, 0);color: #ffffff;font-size: 17px;height: 62px;line-height: 85px;text-align: center;}
	.shop-panel{padding:21px 12px 12px;color:#FFF;position: relative}
	.logo-area{margin-bottom:7px;}
	.logo-area .logo{width:38px;height: 38px;padding-top: 0;margin-right: 7px;border-radius: 22px;border: 1px solid #d3d3d3;}
	.logo-area .logo img{width:38px;height: 38px;border-radius: 22px;}
	.msg-area{}
	.tick-msg{text-align: center;margin-bottom: 6px;color:#fff;}
	.tick-msg b{font-weight: normal;font-size:24px;color:#fff}
	.tick-time{text-align: center;color:#fff}
	.deco{position:absolute;bottom: -1px;left: 0;width: 100%;height: 5px;background: url(./resource/images/card_tpl.png) repeat-x;}
	.card-dispose{padding:15px 0;border-bottom: 1px solid #e7e7eb;margin-bottom: 15px;background: #fff;position: relative}
	.unset{height:30px;line-height:30px;padding-left:15px;display: none;}
	.barcode{width:320px;height:71px;margin:0 auto;background:url("./resource/images/card.png") 27px -156px no-repeat}
	.qrcode{width:320px;height:174px;margin:0 auto;background:url("./resource/images/card.png") 70px -237px no-repeat}
	.sn-area{text-align: center;font-size:25px;color:#000;}
	.code_num{font-size:15px;text-align: center;margin-bottom: 10px;}
	.list{border-top:1px solid #e7e7eb;border-bottom:1px solid #e7e7eb;background: #fff;padding:0;}
	.list li{padding-left:15px;list-style: none;position: relative}
	.li-panel{padding:11px 30px 11px 0;display:block;border-bottom: 1px solid #e7e7eb;}
	.ricon{position: absolute;right:20px;top:15px}
	.cicon{position: absolute;left:50%;top:25%;display:none;}
	.hover{background: #E9E9E9;opacity:0.8}
	.arrow_in{position: absolute;width:0;height:0;border-width: 12px;border-style: dashed;border-color: transparent;top:120px;left:-13px;border-left-width: 0;border-right-color: #f4f5f9;border-right-style: solid;}
	.code_preview{display: none}
</style>
{if $op == 'post' && !$id}
<div class="main">
	<form action="" method="post" id="form-location" class="form-horizontal" enctype="multipart/form-data">
	<div class="panel panel-default" id="step1">
		<div class="panel-heading">
			优惠券
		</div>
		<div class="panel-body">
			<div class="pull-left" style="width:320px;background:#F4F5F9;margin-right:20px;border:1px solid #E7E7EB">
				<div class="card-title">优惠券</div>
				<div class="card_section" style="position: relative">
					<div class="shop-panel" id="color-purview" style="background: #a9d92d">
						<div class="logo-area">
							<span class="logo pull-left"><img src="{$setting['logourl']}" alt=""/></span>
							<div class="pull-left" style="height:38px;line-height:38px" id="brand_name">商家信息</div>
							<div class="clear"></div>
						</div>
						<div class="msg-area">
							<div class="tick-msg">
								<p><b id="title-purview">优惠券标题</b></p>
								<p id="sub-title-purview">优惠券副标题</p>
							</div>
							<p id="sub-time-purview" style="text-align: center">有效期:{php echo date('Y-m-d')} ~ {php echo date('Y-m-d', time() + 30 * 86400)}</p>
						</div>
						<div class="deco"></div>
						<div class="cicon">
							<a href="javascript:;" data-id="form1"><i class="fa fa-pencil"></i></a>
						</div>
					</div>
				</div>
				<div class="card-dispose">
					<div class="unset" id="destroy_title">
						<p>销券设置</p>
					</div>
					<div class="destroy_type_preview">
						<div class="barcode-area code_preview code_preview_3" style="display: block">
							<div class="barcode"></div>
							<p class="code_num">1513-2290-1878</p>
						</div>
						<div class="qrcode-area code_preview code_preview_2">
							<div class="qrcode"></div>
							<p class="code_num">1513-2290-1878</p>
						</div>
						<div class="sn-area code_preview code_preview_1">1513-2290-1878</div>
						<p style="text-align: center" id="notice-purview">请在付款时出示此券</p>
					</div>
					<div class="cicon">
						<a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
					</div>
				</div>
				<div class="shop-detail">
					<ul class="list">
						<li>
							<div class="li-panel">
								<div class="li-content">优惠券详情</div>
								<span class="ricon fa fa-angle-right"></span>
								<div class="cicon">
									<a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
						<li>
							<div class="li-panel">
								<div class="li-content">适用门店</div>
								<span class="ricon fa fa-angle-right"></span>
								<div class="cicon">
									<a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
					</ul>
				</div>
				<div class="shop-detail">
					<ul class="list">
						<li>
							<div class="li-panel">
								<div class="li-content">立即使用</div>
								<span class="ricon">系统已实现</span>
							</div>
						</li>
						<li>
							<div class="li-panel" style="border-bottom: none">
								<div class="li-content" id="promotion_url_name">个人中心</div>
								<div class="ricon"><span id="promotion_url_sub_title">点击进入 </span><i class="fa fa-angle-right"></i></div>
								<div class="cicon">
									<a href="javascript:;" data-id="form6"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
					</ul>
				</div>
			</div>
			<div class="pull-left alert form" style="width:700px;position:relative;display:block;" id="form1">
				<div class="arrow_in"></div>
				<h4 style="margin-top:20px;">券面信息</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 是否上架</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline">
							<input type="radio" value="1" name="is_display" checked/> 上架
						</label>
						<label class="radio-inline">
							<input type="radio" value="0" name="is_display"/> 下架
						</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商户LOGO</label>
					<div class="col-sm-9 col-xs-12" id="logo_upload">
						{php echo tpl_form_field_wechat_image('logo_url', $setting['logourl'], '', array('acid' => $acid, 'mode' => 'file_upload'));}
						<div class="help-block">商户LOGO大小不超过1M。像素为：300*300。仅支持JPG格式</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商家信息</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="brand_name"/>
						<div class="help-block">商户名字,字数上限为12个汉字。 </div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 卡券颜色</label>
					{php echo coupon_colors('color', 'Color082', $colors);}
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 优惠券标题</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="title"/>
						<div class="help-block">建议填写优惠券提供的服务或商品名称，描述卡券提供的具体优惠。不超过9个字符</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"> 优惠券副标题(可选)</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="sub_title"/>
						<div class="help-block">不超过18个字符</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px"> 有效期</label>
					<div class="col-sm-9 col-xs-12">
						<div class="radio">
							<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="1" name="time_type" checked/>固定日期 </label></div>
							{php echo tpl_form_field_daterange('time_limit', array('start' => date('Y-m-d'), 'end' => date('Y-m-d', time() + 30*86400)));}
						</div>
						<div class="radio">
							<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="2" name="time_type"/>领取后 </label></div>
							<div class="col-sm-3" style="margin-left:-15px">
								<select name="deadline" id="deadline" class="form-control">
									<?php
														for($i=0; $i<=90; $i++) {
															if(!$i) $n = '当'; else $n = $i;
															echo '<option value="'.$i.'">'.$n.'天</option>';
									}
									?>
								</select>
							</div>
							<div class="col-sm-3" style="padding-top:6px">有效,有效期</div>
							<div class="col-sm-3" style="margin-left:-15px">
								<select name="limit" id="limit" class="form-control">
									<?php
														for($i=1; $i<=90; $i++) {
															echo '<option value="'.$i.'">'.$i.'天</option>';
									}
									?>
								</select>
							</div>

						</div>
					</div>
				</div>
			</div>
			<div class="pull-left alert form" style="width:700px;position:relative;" id="form2">
				<div class="arrow_in"></div>
				<h4 style="margin-top:20px;">领券设置</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 库存</label>
					<div class="col-sm-9 col-xs-12">
						<div class="input-group">
							<input type="text" class="form-control" name="quantity" value="300"/>
							<span class="input-group-addon">份</span>
						</div>
						<div class="help-block">库存只能是大于0的数字</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 领券限制</label>
					<div class="col-sm-9 col-xs-12">
						<div class="input-group">
							<input type="text" class="form-control" name="get_limit" value="10"/>
							<span class="input-group-addon">份</span>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
					<div class="col-sm-9 col-xs-12">
						<div class="checkbox">
							<label><input type="checkbox" name="can_share" value="1" checked/> 用户可以分享领券链接</label>
						</div>
						<div class="checkbox">
							<label><input type="checkbox" name="can_give_friend" value="1" checked/> 用户领券后可转赠其他好友</label>
						</div>
					</div>
				</div>
				<h4 style="margin-top:20px;">销券设置</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">销券方式</label>
					<div class="col-sm-9 col-xs-12">
						<div class="radio">
							<label><input type="radio"  class="" name="code_type" value="1"/> 仅卡券号</label>
							<div class="help-block">只显示卡券号，验证后可进行销券</div>
						</div>
						<div class="radio">
							<label><input type="radio"  class="" name="code_type" value="2"/> 二维码</label>
							<div class="help-block">包含卡券信息的二维码，扫描后可进行销券</div>
						</div>
						<div class="radio">
							<label><input type="radio"  class="" name="code_type" value="3" checked/> 条形码</label>
							<div class="help-block">包含卡券信息的条形码，扫描后可进行销券</div>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 操作提示</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="notice" id="notice" value="请在付款时出示此券"/>
						<div class="help-block">建议引导用户到店出示卡券，由店员完成核销操作。不超过16个字符</div>
					</div>
				</div>
			</div>
			<div class="pull-left alert form" style="width:700px;position:relative;" id="form3">
				<div class="arrow_in"></div>
				<h4 style="margin-top:20px;">优惠券详情</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 优惠详情</label>
					<div class="col-sm-9 col-xs-12">
						<textarea name="default_detail" id="default_detail" class="form-control" rows="7"></textarea>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 使用须知</label>
					<div class="col-sm-9 col-xs-12">
						<textarea name="description" id="description" class="form-control" rows="7"></textarea>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 客服电话</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="service_phone"/>
						<div class="help-block">手机或固话</div>
					</div>
				</div>
			</div>
			<div class="pull-left alert form" style="width:700px;position:relative;" id="form4">
				<input type="hidden" name="location-select" value=""/>
				<div class="arrow_in"></div>
				<h4 style="margin-top:20px;">服务信息</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 适用门店</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio"><input type="radio" value="1" name="is_location"/> 指定门店适用</label>
						<a href="javascript:;" class="label label-success" style="" id="select-location">选择适用门店</a>
						<table class="table" id="location-contain-out"  style="width:500px;max-width:500px;min-width:500px;display: none">
							<thead>
							<th>名称</th>
							<th>地址</th>
							<th>操作</th>
							</thead>
							<tbody id="location-contain">
							</tbody>
						</table>
						<label class="radio"><input type="radio" value="2" name="is_location" checked/> 全部门店适用</label>
					</div>
				</div>
			</div>
			<div class="pull-left alert form" style="width:700px;position:relative;" id="form6">
				<div class="arrow_in"></div>
				<h4 style="margin-top:20px;">营销入口</h4>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销场景的自定义入口名称</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="promotion_url_name" value="个人中心"/>
						<div class="help-block">如：个人中心。</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 跳转链接</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="promotion_url" value="{php echo murl('mc/home/', array(), true, true);}"/>
						<div class="help-block">入口跳转链接地址。需要以"http://"或"https://"开头</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销入口右侧的提示语</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" class="form-control" name="promotion_url_sub_title" value="点击进入"/>
						<div class="help-block">营销入口右侧的提示语.不超过6个汉字</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="form-group col-sm-12">
		<input name="submit" id="coupon-submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
		<input type="hidden" name="token" value="{$_W['token']}" />
	</div>
</form>
</div>
<div id="footer-location" class="hide">
	<span name="submit" id="submit" class="pull-right btn btn-primary">保存</span>
</div>
<script>
	$('.list li,.card-dispose,.shop-panel').hover(function(){
		$(this).find('.cicon').show();
		$(this).addClass('hover');
	}, function(){
		$(this).find('.cicon').hide();
		$(this).removeClass('hover');
	});
	$('#form1').mouseover(function(){
		var bg_color = $(':input[name="color-value"]').val();
		if(!bg_color) {
			bg_color = '#a9d92d';
		}
		$('#color-purview').css('background-color', bg_color);
		if($(':input[name="title"]').val()) {
			$('#title-purview').html($(':input[name="title"]').val());
		}
		if($(':input[name="sub_title"]').val()) {
			$('#sub-title-purview').html($(':input[name="sub_title"]').val());
		}
		if($(':input[name="brand_name"]').val()) {
			$('#brand_name').html($(':input[name="brand_name"]').val());
		}
		$('.logo-area img').attr('src', $('#logo_upload img').attr('src'));
		var time_type = $(':radio[name="time_type"]:checked').val();
		var time = '';
		if(time_type == 1) {
			var startime = $("input[name='time_limit[start]']").val();
			var endtime = $("input[name='time_limit[end]']").val();
			time = '有效期:'+startime+'~'+endtime;
		} else if(time_type == 2) {
			var deadline = parseInt($('#deadline').val());
			var limit = parseInt($('#limit').val());
			var now = new Date();
			now.setHours(0, 0, 0);
			var unixtime =Date.parse(now)/1000;
			unixtime += (deadline*86400);
			var startime = new Date(parseInt(unixtime) * 1000).toLocaleString().substr(0,9).replace(/\//g, "-");
			unixtime += (limit*86400);
			var endtime = new Date(parseInt(unixtime) * 1000).toLocaleString().substr(0,9).replace(/\//g, "-");
			time = '有效期:'+startime+'~'+endtime;
		}
		$('#sub-time-purview').html(time);
	});

	$('.cicon a').click(function(){
		$('.form').hide();
		var top = $(this).offset().top;
		$('#'+$(this).attr('data-id')).css('margin-top',(top-300))
		$('#'+$(this).attr('data-id')).show();
		return false;
	})

	$('#form2').mouseover(function(){
		var code_type = $('#form2 :radio[name="code_type"]:checked').val() || 0;
		if(code_type) {
			$('#destroy_title').hide();
			$('.code_preview').hide();
			$('.code_preview_' + code_type).show();
		}
		$('#notice-purview').html($('#form2 :text[name="notice"]').val());
	});
	$('#form4 :radio[name="is_location"]').click(function(){
		var is_location = $('#form4 :radio[name="is_location"]:checked').val() || 1;
		if(is_location == 1) {
			$('#select-location').show();
		} else {
			$('#select-location, #location-contain-out').hide();
		}
	});

	//选择门店
	$('#select-location').click(function(){
		var obj = util.dialog('选择适用门店', ["{php echo url('wechat/card/location')}"], $('#footer-location').html());

		obj.modal('show');
		obj.find('.btn.btn-primary').click(function(){
			var chks = $('.location-list :checkbox:checked');
			var locations = [];
			var locations_detail = [];
			var tmp = [];
			if(chks.length>0){
				$.each(chks, function(){
					locations.push($(this).val());
					tmp['id'] = $(this).attr('data-id');
					tmp['name'] = $('#loca-' + $(this).attr('data-id') + ' .name').html();
					tmp['address'] = $('#loca-' + $(this).attr('data-id') + ' .address').html();
					locations_detail.push(tmp);
					tmp=[];
				});
				var s = locations.join('-');
				$('#form4 input[name="location-select"]').val(s);

				if(locations_detail) {
					var str = '';
					for(var i = 0;i<locations_detail.length;i++) {
						str += '<tr>' +
								'<td>'+locations_detail[i]['name']+'</td>' +
								'<td>'+locations_detail[i]['address']+'</td>' +
								'<td>'+locations_detail[i]['address']+'</td>' +
								'</tr>';
					}
					$('#location-contain').html(str)
					$('#location-contain-out').show();
				}
			} else {
				$('#form4 input[name="location-select"]').val('');
				$('#location-contain').html('')
			}
			obj.modal('hide');
		});
	});

	$('#coupon-submit').click(function(){
		if(!$.trim($(':input[name="brand_name"]').val())) {
			util.message('请填写商家名称', '','error');
			return false;
		}

		if(!$.trim($(':input[name="color-value"]').val())) {
			util.message('请选择卡券颜色', '','error');
			return false;
		}

		if(!$.trim($(':input[name="title"]').val())) {
			util.message('优惠券标题不能为空', '','error');
			return false;
		}

		var time_type = $(':radio[name="time_type"]:checked').val();
		if(!time_type) {
			util.message('请完善优惠券有效期', '','error');
			return false;
		}

		var quantity = parseInt($.trim($(':text[name="quantity"]').val()));
		if(isNaN(quantity)) {
			util.message("库存只能是大于0的数字",'','error');
			return false;
		}

		var get_limit = parseInt($.trim($(':text[name="get_limit"]').val()));
		if(isNaN(get_limit)) {
			util.message("领券限制不合法",'','error');
			return false;
		}

		var code_type = $(':radio[name="code_type"]:checked').val();
		if(!code_type) {
			util.message('请选择销券方式','','error');
			return false;
		}

		if(!$.trim($(':text[name="notice"]').val())) {
			util.message('请完善操作提示', '','error');
			return false;
		}

		if(!$.trim($('textarea[name="default_detail"]').val())) {
			util.message('请完善优惠详情', '','error');
			return false;
		}

		if(!$.trim($('textarea[name="description"]').val())) {
			util.message('请完善使用须知', '','error');
			return false;
		}

		var is_location = $('#form4 :radio[name="is_location"]:checked').val();
		if(is_location == 1) {
			if(!$('#form4 input[name="location-select"]').val()) {
				util.message('请选择适用门店', '','error');
				return false;
			}
		}

		var data = $('#form-location').serializeArray();
		$('#submit').attr('disabled', true);
		$.post("{php echo url('wechat/card/general_coupon', array('op' => 'post_save'))}", {'data' : data}, function(out){
			var out = $.parseJSON(out);
			if(!out.errno) {
				util.message(out.error, '', 'error');
			} else {
				util.message('添加优惠券成功', "{php echo url('wechat/card/display');}", 'success');
			}
			$('#submit').attr('disabled', false);
			return false;
		});
		return false;
	});
</script>
{else}
<div class="main">
	<form action="" method="post" id="form-location" class="form-horizontal" enctype="multipart/form-data">
		<div class="panel panel-default" id="step1">
			<div class="panel-heading">
				优惠券
			</div>
			<div class="panel-body">
				<div class="pull-left" style="width:320px;background:#F4F5F9;margin-right:20px;border:1px solid #E7E7EB">
				<div class="card-title">优惠券</div>
				<div class="card_section" style="position: relative">
					<div class="shop-panel" id="color-purview" style="background:{$colors[$item['color']]['value']}">
						<div class="logo-area">
							<span class="logo pull-left"><img src="{$item['logo_url']}" alt=""/></span>
							<div class="pull-left" style="height:38px;line-height:38px">{$item['brand_name']}</div>
							<div class="clear"></div>
						</div>
						<div class="msg-area">
							<div class="tick-msg">
								<p><b id="title-purview">{$item['title']}</b></p>
								<p id="sub-title-purview">{$item['sub_title']}</p>
							</div>
							<p id="sub-time-purview" style="text-align: center">
								{if $item['date_info']['time_type'] == 1}
								有效期 {$item['date_info']['time_limit_start']}~{$item['date_info']['time_limit_end']}
								{else}
								有效期 领取后{$item['date_info']['deadline']}天后生效,{$item['date_info']['limit']}天有效
								{/if}
							</p>
						</div>
						<div class="deco"></div>
						<div class="cicon">
							<a href="javascript:;" data-id="form1"><i class="fa fa-pencil"></i></a>
						</div>
					</div>
				</div>
				<div class="card-dispose">
					<div class="destroy_type_preview">
						{if $item['code_type'] == 3}
						<div class="barcode-area code_preview_3">
							<div class="barcode"></div>
							<p class="code_num">1513-2290-1878</p>
						</div>
						{elseif $item['code_type'] == 2}
						<div class="qrcode-area code_preview_2">
							<div class="qrcode"></div>
							<p class="code_num">1513-2290-1878</p>
						</div>
						{else}
						<div class="sn-area code_preview_1">1513-2290-1878</div>
						{/if}
						<p style="text-align: center" id="notice-purview">{$item['notice']}</p>
					</div>
					<div class="cicon">
						<a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
					</div>
				</div>
				<div class="shop-detail">
					<ul class="list">
						<li>
							<div class="li-panel">
								<div class="li-content">优惠券设置</div>
								<span class="ricon fa fa-angle-right"></span>
								<div class="cicon">
									<a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
						<li>
							<div class="li-panel">
								<div class="li-content">适用门店</div>
								<span class="ricon">{$item['location_count']}家</span>
								<div class="cicon">
									<a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
					</ul>
				</div>
				<div class="shop-detail">
					<ul class="list">
						<li>
							<div class="li-panel">
								<div class="li-content">立即使用</div>
								<span class="ricon">系统已实现</span>
							</div>
						</li>
						{if !empty($item['promotion_url_name'])}
						<li>
							<div class="li-panel" style="border-bottom: none">
								<div class="li-content">{$item['promotion_url_name']}</div>
								<div class="ricon"><span>{$item['promotion_url_sub_title']}</span><i class="fa fa-angle-right"></i></div>
								<div class="cicon">
									<a href="javascript:;" data-id="form6"><i class="fa fa-pencil"></i></a>
								</div>
							</div>
						</li>
						{/if}
					</ul>
				</div>
			</div>
				<div class="pull-left alert form" style="width:700px;position:relative;display:block;" id="form1">
				<h4>卷面信息</h4>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券类型</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$types[$item['type']]}</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券id</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$item['card_id']}</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券标题</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{$item['title']}</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券副标题</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">{if !empty($item['sub_title'])}{$item['sub_title']}{else}无{/if}</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 有效期</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{if $item['date_info']['time_type'] == 1}
							{$item['date_info']['time_limit_start']}~{$item['date_info']['time_limit_end']}
							{else}
							领取后{$item['date_info']['deadline']}天后生效,{$item['date_info']['limit']}天有效
							{/if}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 商家名称</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['brand_name']}
						</p>
					</div>
				</div>
				<h4>投放信息</h4>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 库存</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['quantity']}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 领取限制</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							每个用户限领{$item['get_limit']}张
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 销券条码</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{if $item['code_type'] == 1}
							卡号
							{elseif $item['code_type'] == 2}
							二维码
							{else}
							条形码
							{/if}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 操作提示</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['notice']}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 分享设置</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{if $item['can_share']}用户可以分享领券链接{else}用户不能分享领券链接{/if}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 转赠设置</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{if $item['can_give_friend']}用户领券后可转赠其他好友{else}用户领券后不能转赠其他好友{/if}
						</p>
					</div>
				</div>
				<h4>优惠券详情</h4>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 使用须知</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['description']}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 优惠详情</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['extra']}
						</p>
					</div>
				</div>
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 客服电话</label>
					<div class="col-sm-9 col-xs-12">
						<p class="form-control-static">
							{$item['service_phone']}
						</p>
					</div>
				</div>
				<h4>适用门店</h4>
				{if !empty($item['location_id_list'])}
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> </label>
					<div class="col-sm-9 col-xs-12">
						<table class="table" style="min-width:500px;max-width:500px">
							<thead>
							<tr>
								<th>门店名称</th>
								<th>门店地址</th>
							</tr>
							</thead>
							<tbody>
							{loop $item['location_data'] $location}
							<tr>
								<td>{$location['business_name']}</td>
								<td>{$location['address']}</td>
							</tr>
							{/loop}
							</tbody>
						</table>
					</div>
				</div>
				{else}
				<div class="form-group marbot0">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> </label>
					<div class="col-sm-9 col-xs-12">
						暂无适用门店
					</div>
				</div>
				{/if}
			</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<span class="btn btn-primary col-lg-1" onclick="javascript:history.go(-1)">返回</span>
		</div>
	</form>
</div>
{/if}
{template 'common/footer'}